package com.liangzdemo.observer;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.liangzdemo.R;

public class Main2Activity extends AppCompatActivity implements View.OnClickListener{

    private Button button_login;
    private Button botton_nologin;
    private LoginFunction loginFunction;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        loginFunction = new LoginFunction();
        ShopCatObserver shopCatObserver = new ShopCatObserver(loginFunction);
        OrderObserver orderObserver = new OrderObserver(loginFunction);

        button_login = (Button)findViewById(R.id.button);
        botton_nologin =  (Button)findViewById(R.id.button4);
        button_login.setOnClickListener(this);
        botton_nologin.setOnClickListener(this);



        //loginFunction.setLoginTag(false);
    }

    @Override
    public void onClick(View view) {

        switch (view.getId()) {
            case R.id.button:
                loginFunction.setLoginTag(true);
                break;

            case R.id.button4:
                loginFunction.setLoginTag(false);
                break;
        }
    }
}
